<!DOCTYPE html>
<style>
	 body {
	   background:url("bg2.gif")  no-repeat center center;   /*加载背景图*/   /* 背景图不平铺 */
	   background-size:cover;  /* 让背景图基于容器大小伸缩 */
	   background-attachment:fixed;        /* 当内容高度大于图片高度时，背景图像的位置相对于viewport固定 */    //此条属性必须设置否则可能无效/
	   background-color:#CCCCCC;   /* 设置背景颜色，背景图加载过程中会显示背景色 */
	  font-family:YouYuan;
	 }
	 a{
		 color:white;
		  text-decoration:none;
	 }
	 a:hover{
		 color:pink;
		 transform:translatey(50px);
		 text-decoration:none;
	 }
</style>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		
	</head>
	<body>
		<div style="text-align:center ;font-size:40px;margin-top:240px;">
			<a href="index.html" >返回主页</a>
			<p align='center'><a  href="add.php">添加考试</a></p>
			<table border='1' align='center'>
			<tr bgcolor="#cccccc">
				<th>考试班级</th>
				<th>考试科目</th>
				<th>考试时间</th>
				<th>考试地点</th>
				<th>监考老师</th>
				<th>操作</th>
			</tr>
		</div>
	</body>
</html>

<?php
	try{
		$db =new pdo("mysql:host=localhost;dbname=db_database10;charset=utf8","root","");
	}
	catch(Exception $exc){
		echo $exc->getMessage();
	}
	$result = $db->query('select * from exam');
	while($results= $result->fetch(PDO::FETCH_ASSOC)){
		echo "<tr><td>".$results['class']."</td>";
		echo "<td>".$results['course']."</td>";
		echo "<td>".$results['time']."</td>";
		echo "<td>".$results['room']."</td>";
		echo "<td>".$results['teacher']."</td>";
		echo "<td><a href=\"edit.php?ID=".$results['id']."\" >编辑</a>  <a href=\"del.php?ID=".$results['id']."\">删除</a></td></tr>";
	}
?>